/*
* Copyright (c) 2020 - 2025 Renesas Electronics Corporation and/or its affiliates
*
* SPDX-License-Identifier: BSD-3-Clause
*/

/***********************************************************************************************************************
 * Includes
 **********************************************************************************************************************/
#include "r_rsip_primitive.h"
#include "r_rsip_util.h"

/***********************************************************************************************************************
 * Global variables
 **********************************************************************************************************************/

uint32_t         S_RAM[RSIP_PRV_WORD_SIZE_S_RAM];
uint32_t const * S_INST2;
uint32_t         INST_DATA_SIZE;

uint32_t const DomainParam_NIST_P256[] =
{
    BSWAP_32BIG_C(0x646d9b3cU), BSWAP_32BIG_C(0xa740e0d8U), BSWAP_32BIG_C(0x14953f12U), BSWAP_32BIG_C(0xca1d90faU),
    BSWAP_32BIG_C(0x6f8993baU), BSWAP_32BIG_C(0x150c91caU), BSWAP_32BIG_C(0xf075f037U), BSWAP_32BIG_C(0xe1be2d57U),
    BSWAP_32BIG_C(0x5e63ad9fU), BSWAP_32BIG_C(0x15426e2eU), BSWAP_32BIG_C(0x97b77340U), BSWAP_32BIG_C(0xb2c3da0aU),
    BSWAP_32BIG_C(0x437815a0U), BSWAP_32BIG_C(0xfc91cdb5U), BSWAP_32BIG_C(0x47da485dU), BSWAP_32BIG_C(0x765ff0acU),
    BSWAP_32BIG_C(0x167f5522U), BSWAP_32BIG_C(0xd5fa6619U), BSWAP_32BIG_C(0x23469968U), BSWAP_32BIG_C(0xe46a9817U),
    BSWAP_32BIG_C(0xa32bbb8aU), BSWAP_32BIG_C(0xdaee68bbU), BSWAP_32BIG_C(0x537a3bb6U), BSWAP_32BIG_C(0x0897fe04U),
    BSWAP_32BIG_C(0x545d0562U), BSWAP_32BIG_C(0xc30d1b7eU), BSWAP_32BIG_C(0xab4770c2U), BSWAP_32BIG_C(0xacfe2f1eU),
    BSWAP_32BIG_C(0xf62f2ef1U), BSWAP_32BIG_C(0x705ce539U), BSWAP_32BIG_C(0x6c29d9d5U), BSWAP_32BIG_C(0x6d0e7f05U),
    BSWAP_32BIG_C(0xeda353e0U), BSWAP_32BIG_C(0x02e966d2U), BSWAP_32BIG_C(0x9c1e5923U), BSWAP_32BIG_C(0x20d4b26aU),
    BSWAP_32BIG_C(0x3acce832U), BSWAP_32BIG_C(0xce7be734U), BSWAP_32BIG_C(0xa1d287e8U), BSWAP_32BIG_C(0xb6c1bc37U),
    BSWAP_32BIG_C(0xd98571d4U), BSWAP_32BIG_C(0xade3fd3aU), BSWAP_32BIG_C(0xb10af158U), BSWAP_32BIG_C(0x0b5a0177U),
    BSWAP_32BIG_C(0xc6203d55U), BSWAP_32BIG_C(0x905c6266U), BSWAP_32BIG_C(0xdf0c9ac3U), BSWAP_32BIG_C(0x0198a9e5U),
    BSWAP_32BIG_C(0x7f75f86cU), BSWAP_32BIG_C(0xca00c7d0U), BSWAP_32BIG_C(0x51ac028eU), BSWAP_32BIG_C(0xcbf43f06U),
    BSWAP_32BIG_C(0xb029a4e0U), BSWAP_32BIG_C(0xb8bed4ebU), BSWAP_32BIG_C(0xa53c40c3U), BSWAP_32BIG_C(0x83abc923U),
    BSWAP_32BIG_C(0x01fd7d1cU), BSWAP_32BIG_C(0xc01a0e90U), BSWAP_32BIG_C(0x2350c769U), BSWAP_32BIG_C(0x9d9ea28dU),
    BSWAP_32BIG_C(0xe9d3a38fU), BSWAP_32BIG_C(0xe2f06bd2U), BSWAP_32BIG_C(0x87d1e891U), BSWAP_32BIG_C(0xac087462U),
    BSWAP_32BIG_C(0x0dd38e41U), BSWAP_32BIG_C(0xb6ee6c1aU), BSWAP_32BIG_C(0x97ab7790U), BSWAP_32BIG_C(0x01190e35U),
    BSWAP_32BIG_C(0x0c1d5cc7U), BSWAP_32BIG_C(0xb8750a2bU), BSWAP_32BIG_C(0x8ea6a7a6U), BSWAP_32BIG_C(0x3b7deb84U),
};

uint32_t const DomainParam_Brainpool_256r1[] =
{
    BSWAP_32BIG_C(0xc999eebfU), BSWAP_32BIG_C(0x6f3c128eU), BSWAP_32BIG_C(0x708265c3U), BSWAP_32BIG_C(0x1ff33c63U),
    BSWAP_32BIG_C(0x31af2835U), BSWAP_32BIG_C(0x51b4fe2fU), BSWAP_32BIG_C(0xbbedf4c5U), BSWAP_32BIG_C(0x2e3e6987U),
    BSWAP_32BIG_C(0x6cae110cU), BSWAP_32BIG_C(0xdfd940f9U), BSWAP_32BIG_C(0x618ea772U), BSWAP_32BIG_C(0x6da7dd5dU),
    BSWAP_32BIG_C(0x8f21328eU), BSWAP_32BIG_C(0xc4855a24U), BSWAP_32BIG_C(0x694f5872U), BSWAP_32BIG_C(0x8cf4e620U),
    BSWAP_32BIG_C(0x42d5cc2fU), BSWAP_32BIG_C(0x2f5295b3U), BSWAP_32BIG_C(0xb5c59be3U), BSWAP_32BIG_C(0x89e3efa8U),
    BSWAP_32BIG_C(0xd2595a8bU), BSWAP_32BIG_C(0xc6dcfea9U), BSWAP_32BIG_C(0xd3e4c604U), BSWAP_32BIG_C(0xd0fb6865U),
    BSWAP_32BIG_C(0x57a886f8U), BSWAP_32BIG_C(0xf9b777e3U), BSWAP_32BIG_C(0xdbc64ec2U), BSWAP_32BIG_C(0x00aaff5dU),
    BSWAP_32BIG_C(0x9520401cU), BSWAP_32BIG_C(0x8cea6a71U), BSWAP_32BIG_C(0x46ee670eU), BSWAP_32BIG_C(0x2891cf22U),
    BSWAP_32BIG_C(0xc80a4209U), BSWAP_32BIG_C(0xd31d29fdU), BSWAP_32BIG_C(0x33090fcdU), BSWAP_32BIG_C(0x270c2346U),
    BSWAP_32BIG_C(0xb7161131U), BSWAP_32BIG_C(0x4b2ad270U), BSWAP_32BIG_C(0x4fcd4047U), BSWAP_32BIG_C(0x867fd3d3U),
    BSWAP_32BIG_C(0x75898eddU), BSWAP_32BIG_C(0x59838818U), BSWAP_32BIG_C(0x3ca641aaU), BSWAP_32BIG_C(0x19582d24U),
    BSWAP_32BIG_C(0x17462068U), BSWAP_32BIG_C(0x8261aa24U), BSWAP_32BIG_C(0x807b1b62U), BSWAP_32BIG_C(0x03aef883U),
    BSWAP_32BIG_C(0x77c94befU), BSWAP_32BIG_C(0xe9cdda84U), BSWAP_32BIG_C(0x39218861U), BSWAP_32BIG_C(0xa489c425U),
    BSWAP_32BIG_C(0x5b9412beU), BSWAP_32BIG_C(0x7e35b13dU), BSWAP_32BIG_C(0x58a68a8eU), BSWAP_32BIG_C(0xe488e44fU),
    BSWAP_32BIG_C(0x4f06a220U), BSWAP_32BIG_C(0x45c4e7aeU), BSWAP_32BIG_C(0x9902876eU), BSWAP_32BIG_C(0xcfc5b797U),
    BSWAP_32BIG_C(0x1215e0eaU), BSWAP_32BIG_C(0x498d0ea6U), BSWAP_32BIG_C(0x71e5354aU), BSWAP_32BIG_C(0x65071e22U),
    BSWAP_32BIG_C(0x4c090ec4U), BSWAP_32BIG_C(0x0acde2f6U), BSWAP_32BIG_C(0x0b7b9cbcU), BSWAP_32BIG_C(0x1fdf6ea7U),
    BSWAP_32BIG_C(0x0b9042b0U), BSWAP_32BIG_C(0x253bf53bU), BSWAP_32BIG_C(0x4fe83406U), BSWAP_32BIG_C(0x3bbc0874U),
};

uint32_t const DomainParam_Koblitz_secp256k1[] =
{
    BSWAP_32BIG_C(0x1e4cf53cU), BSWAP_32BIG_C(0x8bad330fU), BSWAP_32BIG_C(0xbdf78b51U), BSWAP_32BIG_C(0xd49a352eU),
    BSWAP_32BIG_C(0x837dcdcdU), BSWAP_32BIG_C(0xa79bded7U), BSWAP_32BIG_C(0xe44d1b59U), BSWAP_32BIG_C(0x817eb64dU),
    BSWAP_32BIG_C(0x1ef15639U), BSWAP_32BIG_C(0x4aff7aa7U), BSWAP_32BIG_C(0x794ad9baU), BSWAP_32BIG_C(0x130237ecU),
    BSWAP_32BIG_C(0xcd3bd86bU), BSWAP_32BIG_C(0xabccd49cU), BSWAP_32BIG_C(0xe9ac2baeU), BSWAP_32BIG_C(0x8a81d73cU),
    BSWAP_32BIG_C(0xf47c6d5dU), BSWAP_32BIG_C(0x3cd3e7f3U), BSWAP_32BIG_C(0x347be528U), BSWAP_32BIG_C(0x91f0e9a9U),
    BSWAP_32BIG_C(0x91a2d3b7U), BSWAP_32BIG_C(0x475270bcU), BSWAP_32BIG_C(0xb17e15f2U), BSWAP_32BIG_C(0xe1b67a5fU),
    BSWAP_32BIG_C(0x418c7e1aU), BSWAP_32BIG_C(0xc2a86b1cU), BSWAP_32BIG_C(0x03a9f435U), BSWAP_32BIG_C(0x95acd7b9U),
    BSWAP_32BIG_C(0x6ce1710cU), BSWAP_32BIG_C(0x3c3e9874U), BSWAP_32BIG_C(0x85659b53U), BSWAP_32BIG_C(0xd54f6ceeU),
    BSWAP_32BIG_C(0x6981ea63U), BSWAP_32BIG_C(0x65b498b8U), BSWAP_32BIG_C(0x37fd5b83U), BSWAP_32BIG_C(0x6a5755e9U),
    BSWAP_32BIG_C(0x14ad2487U), BSWAP_32BIG_C(0x907c905dU), BSWAP_32BIG_C(0x553c8792U), BSWAP_32BIG_C(0xe8b69185U),
    BSWAP_32BIG_C(0x969a4ea1U), BSWAP_32BIG_C(0xb0ad5dfbU), BSWAP_32BIG_C(0xd5329e34U), BSWAP_32BIG_C(0x21d3e61bU),
    BSWAP_32BIG_C(0x7c256278U), BSWAP_32BIG_C(0x32408bd3U), BSWAP_32BIG_C(0x073f0d01U), BSWAP_32BIG_C(0x94c6c952U),
    BSWAP_32BIG_C(0xa5176d9fU), BSWAP_32BIG_C(0x4beee48eU), BSWAP_32BIG_C(0xfc9f69cfU), BSWAP_32BIG_C(0x43ede682U),
    BSWAP_32BIG_C(0xd31fbf75U), BSWAP_32BIG_C(0x005b95dfU), BSWAP_32BIG_C(0x9e3ed957U), BSWAP_32BIG_C(0x8a212da6U),
    BSWAP_32BIG_C(0xab59d528U), BSWAP_32BIG_C(0xa36d4bb5U), BSWAP_32BIG_C(0x5403a032U), BSWAP_32BIG_C(0xe8c9c70eU),
    BSWAP_32BIG_C(0x5af54c0eU), BSWAP_32BIG_C(0x67921519U), BSWAP_32BIG_C(0x102ad293U), BSWAP_32BIG_C(0xd7b5659cU),
    BSWAP_32BIG_C(0xb083a974U), BSWAP_32BIG_C(0xbf1327e2U), BSWAP_32BIG_C(0x415b9243U), BSWAP_32BIG_C(0x3b9db013U),
    BSWAP_32BIG_C(0xfbb849e9U), BSWAP_32BIG_C(0xee503846U), BSWAP_32BIG_C(0x6faf776eU), BSWAP_32BIG_C(0xd308ee66U),
};
